<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Services\Ip2RegionService;
use App\Http\Service\IpService;

class IpController extends BaseController
{
    private $ip2RegionService;
    private $ipService;

    public function __construct(Ip2RegionService $ip2RegionService,IpService $ipService)
    {
        $this->ip2RegionService = $ip2RegionService;
        $this->ipService=$ipService;
    }

    /**
     * 查询指定IP
     */
    public function queryIp(Request $request, $ip = null)
    {

        $ip = $ip ?: $request->json('ip', $request->ip());
        
        $result = $this->ipService->getIp($request,$ip);

        $this->success($result);
        
    }

   

}
